package demo6;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class Person {
  /*  @Resource(name = "shirt")//类名首字母小写,其余与类名完全一致即可
    private Clothes clothes;*/

    @Resource
    private Clothes shirt;//根据属性名装配,与类名一致(除了首字母小写)

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + shirt +
                '}';
    }
}
